<template>
	<view class="wp">
		<view class="banner">
			<swiper class="swiper" circular :indicator-dots="true" :autoplay="true" :interval="5000"
				:duration="500">
				<swiper-item>
					<view class="swiper-item uni-bg-red">
						<image src="https://img.jinghushi.com/images/0/2025/06/OUg2KcHtMoTHLMPMMCra4CuKahTL6P.png"></image>
					</view>
				</swiper-item>
			</swiper>
			<view class="flex_align_center shop_info" v-if="uid">
				<image :src="info.img"></image>
				<view class="shop_name">
					<view class="shop_tit">{{info.store_name}}的数字店铺</view>
					<view>店铺编号：{{uid}}</view>
				</view>
			</view>
		</view>
		<image src="/static/bg.jpg" class="shop_bg" mode="widthFix"></image>
		<view class="shop_list">
			<liu-waterfall :bgColor="'#eeeeeeba'" :dataList.sync="guessGoods" :column="2" @click="wateClick"></liu-waterfall>
			<view class="empty_loading">
				<image v-if="isloading" src="/static/business/loading.gif" ></image>
				<text v-if="isempty">没有更多了~</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				guessGoods: [],
				pageGuess: 0,
				isloading: false,
				isempty: false,
				info: [],
				uid: 0
			}
		},
		onLoad(options) {
			if(options.uid){
				this.uid = options.uid
				uni.setStorageSync('uid',this.uid);
				this.getInfo()
			}
			// this.getRandomInt(0,5);
			this.getGuessGoods();
		},
		onReachBottom(){
			this.getGuessGoods();
		},
		methods: {
			getInfo() {
				this.$axios('BusinessLicense/licenseStore', 'POST', 'business', {
					member_id: this.uid
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data;
					}
				})
			},
			getRandomInt(min,max){
				this.pageGuess = Math.floor(Math.random() * (max - min)) + min;
			},
			wateClick(data) {
				this.$navTo('/pages/product/product?id='+data.id)
			},
			getGuessGoods(){
				if(this.pageGuess>=2){
					return;
				}
				this.pageGuess++;
				this.isloading = true;
				this.isempty = false;
				this.$axios('Lists/index', 'POST', 'shop',{
					page: this.pageGuess,
					ccate: 3627
				}).then(res=>{
					this.isloading = false;
					if(res.data.code == 200){
						this.guessGoods = [...this.guessGoods,...res.data.data.goods];
						this.isempty = res.data.data.goods.length <= 0;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.wp{
	background: #eeeeeeba;
}
.banner{
	width: 100%;
	position: relative;
	margin-bottom: 20rpx;
	.swiper{
		height: 500rpx;
		.swiper-item{
			width: 100%;
			height: 100%;
			image{
				width: 100%;
				height: 100%;
			}
		}
	}
	.shop_info{
		background: rgba(#fff,.5);
		border-radius: 12rpx;
		padding: 10rpx;
		position: absolute;
		left: 20rpx;
		top: 50rpx;
		image{
			width: 80rpx;
			height: 80rpx;
			border-radius: 8rpx;
			margin-right: 10rpx;
			flex-shrink: 0;
		}
		.shop_name{
			font-size: 24rpx;
			color: #666;
			flex: 1;
			.shop_tit{
				font-size: 28rpx;
				color: #333;
				font-weight: bold;
				margin-bottom: 4rpx;
			}
		}
	}
}
.shop_bg{
	width: 100%;
	display: block;
}
.shop_list{
	padding: 0 20rpx;
	background: #eeeeeeba;
}
</style>
